<?php 
if($mode== "ADD"){

	?>
<script
	type="text/javascript"
	src="<?= base_url();?>third_party/fancy_box/lib/jquery-1.8.0.min.js"></script>
<link
	rel="stylesheet" type="text/css" media="all"
	href="<?= base_url();?>third_party/jsdatepick-calendar/jsDatePick_ltr.min.css" />
<script
	type="text/javascript"
	src="<?= base_url();?>third_party/jsdatepick-calendar/jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
	window.onload = function(){
		new JsDatePick({
			useMode:2,
			target:"startDate",
			dateFormat:"%d-%m-%Y"			
		});
		new JsDatePick({
			useMode:2,
			target:"endDate",
			dateFormat:"%d-%m-%Y"			
		});
	};
</script>

<section class="wrapper">


	<!-- page start-->
	<section class="panel">
		<header class="panel-heading"> BANNER MANAGEMENT (ADD) <span class="pull-right"><a href="<?= base_url();?>banner/admin/admin_banner/banner_list"
				type="button" class="btn btn-success btn-sm">Go to BannerList</a> </span></header>
		<div class="panel-body">
			<form class="form-horizontal" role="form"
			method="POST" enctype="multipart/form-data"
				action="<?= base_url(); ?>banner/admin/admin_banner/upload_banner">
							<?php
								$this->session->flashdata('message'); {
									$msg = $this->session->flashdata('message');
									echo '<font color="red">' . $msg . '</font>';
								}
								?>
				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Select Size</label>
					<div class="col-lg-2">
						<select class="form-control" name="banner_size">
							<option selected="selected" value="">---Select Size---</option>
							<?php foreach ($pickup['banner_size'] as $banner_size): ?>
										<option value="<?= $banner_size->description; ?>">
											<?= $banner_size->description; ?>
										</option>
										<?php endforeach; ?>
						</select>
						
					</div>
					<div class="col-lg-4">
								
								<input type="file" class="form-control" name="userfile" value="Browse" />
                        <input type="hidden" name="id">
									
								</div>
					<span class="text text-warning"><b>(IMAGE SIZE : WIDTH X HEIGHT<br>
								FRONT SLIDER IMAGE : 724 X 200)</b></span>			
				</div>
				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Banner title</label>
					<div class="col-lg-6">
						<input type="text" class="form-control" name="banner_title" id="banner_title"
							placeholder="Banner Title">
					</div>
				</div>

				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Link</label>
					<div class="col-lg-6">
						<input type="text" class="form-control" name="link" id="link"
							placeholder="Banner Link">
					</div>
				</div>

				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Start date</label>
					<div class="col-lg-3">
						<input type="text" class="form-control" name="start_date"
							id=startDate placeholder="Start Date">
					</div>
				</div>

				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">End date</label>
					<div class="col-lg-3">
						<input type="text" class="form-control" name="end_date"
							id="endDate" placeholder="End Date">
					</div>
				</div>

				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Max impressions</label>
					<div class="col-lg-1">
						<input type="text" class="form-control" name="impression" 
							id="impression" placeholder="Max Impressions">
					</div>
					<span class="text text-warning"><b>( 0 = UNLIMITED )</b></span>
				</div>
				
				<!-- <div class="form-group">
					<label for="input" class="col-lg-2 control-label">Max clicks</label>
					<div class="col-lg-1">
						<input type="text" class="form-control" name="click" 
							id="click" placeholder="Max Clicks">
					</div>
					<span class="text text-warning"><b>( 0 = UNLIMITED )</b></span>
				</div> -->

				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Show</label>
					<div class="col-lg-2">
						<select class="form-control" name="show">
							<option selected="selected" value="">---Select Pgae---</option>
										<option value="0">All</option>
							<option value="1">Index Page</option>
							<option value="2">Inner Page</option>
							<option value="3">Category </opyion>
							<option value="4">Slider</option>
							</select>
						</select>
					</div>
					<span class="text text-warning"><b>( ASSIGN PAGE )</b></span>
				</div>



				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Select Category</label>
					<div class="col-lg-4">
						<select class="form-control" name="category">
							<option selected="selected" value="">- - - - - - - - -  Select Category - -  - - - - - -</option>
							<?php foreach($parent as $parent):?>
										<option value="<?= $parent->id;?>"><?= $parent->name;?></option>
							<?php endforeach;?>
						</select>
					</div>
					<span class="text text-warning"><b>( ASSIGN CATEGORY )</b></span>
					
				</div>

				<div class="form-group">
					<div class="col-lg-offset-2 col-lg-10">
				<input type="submit" name="upload" class="btn btn-warning" value="Add Now" <?php if($this->config->item('mode')=='DEMO'){?>onclick="alert ('Sorry! Not allowed in demo mode '); return false;" <?} else?>onclick="return confirm('Are you sure ?');">
					</div>
				</div>
			</form>
		</div>
		<!-- End of Body Panel -->
	</section>
	<!-- page end-->
</section>
<?php }?>
<?php 
if($mode=="EDIT"){
	?>

	<script
	type="text/javascript"
	src="<?= base_url();?>third_party/fancy_box/lib/jquery-1.8.0.min.js"></script>
<link
	rel="stylesheet" type="text/css" media="all"
	href="<?= base_url();?>third_party/jsdatepick-calendar/jsDatePick_ltr.min.css" />
<script
	type="text/javascript"
	src="<?= base_url();?>third_party/jsdatepick-calendar/jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
	window.onload = function(){
		new JsDatePick({
			useMode:2,
			target:"startDate",
			dateFormat:"%d-%m-%Y"			
		});
		new JsDatePick({
			useMode:2,
			target:"endDate",
			dateFormat:"%d-%m-%Y"			
		});
	};
</script>

<section class="wrapper">


	<!-- page start-->
	<section class="panel">
		<header class="panel-heading"> BANNER MANAGEMENT (EDIT) <span class="pull-right"><a href="<?= base_url();?>banner/admin/admin_banner/banner_list"
				type="button" class="btn btn-success btn-sm">Go to BannerList</a> </span></header>
		<div class="panel-body">
			<form class="form-horizontal" name="banner" role="form"
			method="POST" enctype="multipart/form-data"
				action="<?= base_url(); ?>banner/admin/admin_banner/update_banner">
							<?php
								$this->session->flashdata('message'); {
									$msg = $this->session->flashdata('message');
									echo '<font color="red">' . $msg . '</font>';
								}
								?>
				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Select Size</label>
					<div class="col-lg-2">
						<select class="form-control" name="banner_size">
							<option value="" selected="selected">---Select Size---</option>

										<?php foreach($banner_size as $banner_size):?>
										<option value="<?= $banner_size->description; ?>"
										<?php if($banner_size->description == $banners['details']->size){echo "selected=selected";}?>>
											<?= $banner_size->description; ?>
										</option>
										<?php endforeach; ?>
						</select>
						
					</div>
					<div class="col-lg-4">
								
								<input type="file" class="form-control" name="userfile" value="<?= $banners['details']->file;?>">
                      
								</div>
					<img height="50" width="80"
								src="<?= base_url();?>assets/images/banner/<?= $banners['details']->file;?>" alt="Image 001" />
									
				</div>
				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Banner title</label>
					<div class="col-lg-6">
						<input type="text" class="form-control" name="banner_title" value="<?= $banners['details']->title;?>"
							placeholder="Banner Title">
					</div>
				</div>

				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Link</label>
					<div class="col-lg-6">
						<input type="text" class="form-control" name="link" value="<?= $banners['details']->link;?>"
							placeholder="Banner Link">
					</div>
				</div>

				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Start date</label>
					<div class="col-lg-3">
						<input type="text" class="form-control" name="start_date"
							id=startDate value="<?= $banners['details']->date_start;?>" >
					</div>
				</div>

				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">End date</label>
					<div class="col-lg-3">
						<input type="text" class="form-control" name="end_date"
							id="endDate" value="<?= $banners['details']->date_end;?>" >
					</div>
				</div>

				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Max impressions</label>
					<div class="col-lg-1">
						<input type="text" class="form-control" name="impression" 
							id="impression" value="<?= $banners['details']->max_impressions;?>">
					</div>
					<span class="text text-warning"><b>( 0 = UNLIMITED )</b></span>
				</div>
				
				<!-- <div class="form-group">
					<label for="input" class="col-lg-2 control-label">Max clicks</label>
					<div class="col-lg-1">
						<input type="text" class="form-control" name="click" 
							id="click" value="<?= $banners['details']->max_clicks;?>" >
					</div>
					<span class="text text-warning"><b>( 0 = UNLIMITED )</b></span>
				</div> -->

				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Show</label>
					<div class="col-lg-2">
						<select class="form-control" name="show">
							<option value="0"
									<?php if ($banners['details']->shows=="0") echo 'selected="selected"';?>>All</option>

									<option value="1"
									<?php if ($banners['details']->shows=="1") echo 'selected="selected"';?>>Index Page</option>
									<option value="2"
									<?php if ($banners['details']->shows=="2") echo 'selected="selected"';?>>Inner Page</option>

									<option value="3"
									<?php if ($banners['details']->shows=="3") echo 'selected="selected"';?>>Category</option>
							
									<option value="4"
									<?php if ($banners['details']->shows=="4") echo 'selected="selected"';?>>Front Slider</option>
							
							</select>
						</select>
					</div>
					<span class="text text-warning"><b>( ASSIGN PAGE )</b></span>
				</div>



				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Select Category</label>
					<div class="col-lg-4">
						<select class="form-control" name="category">
							<option>- - - - - - - - -  Select Category - -  - - - - - -</option>
										<?php foreach($parent as $parent):?>
										<option value="<?= $parent->id;?>"
										<?php if($parent->id == $banners['details']->category){echo "selected=selected";}?>>
											<?= $parent->name;?>
										</option>
										<?php endforeach;?>
						</select>
					</div>
					<span class="text text-warning"><b>( ASSIGN CATEGORY )</b></span>
					
				</div>

				<div class="form-group">
					<div class="col-lg-offset-2 col-lg-10">
					<input type="hidden" name="id" value="<?= $id;?>"> 
					<input
										type="submit" class="btn btn-info" name="upload" value="Update" <?php if($this->config->item('mode')=='DEMO'){?>onclick="alert ('Sorry! Not allowed in demo mode '); return false;" <?} else?>onclick="return confirm('Are you sure ?');" />
					
					</div>
				</div>
			</form>
		</div>
		<!-- End of Body Panel -->
	</section>
	<!-- page end-->
</section>
<?php }?>
	


